﻿<Application x:Class="PlayerScanner.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:PlayerScanner"
             xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
             StartupUri="MainWindow.xaml"
             ShutdownMode="OnMainWindowClose">
    <Application.Resources>
        <Style TargetType="Label">
            <Setter Property="Padding" Value="5,0,0,0"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
        </Style>
        <!-- Warning! When WPF resolves a non-string binding for a ContentControl 
             it will put the content into a TextBlock and apply any global TextBlock 
             styles to that generated TextBlock. To avoid this problem, a named style 
             is used instead.
        -->
        <Style x:Key="WrappedTextBlock" TargetType="TextBlock">
            <Setter Property="Padding" Value="5,0,0,0"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="TextWrapping" Value="Wrap"/>
            <Setter Property="Width" Value="250"/>
        </Style>
        <local:PbConverter x:Key="pbConverter"/>
        <local:PlayerViewScopeConverter x:Key="playerViewScopeConverter"/>
        <local:StatusConditionsConverter x:Key="statusConditionsConverter"/>
        <local:ItemCompactColorConverter x:Key="itemColorConverter"/>
        <local:BooleanToEquipConverter x:Key="booleanToEquipConverter"/>
        <local:EquippableByConverter x:Key="equipabbleByConverter"/>
        <local:WeaponCompactConverter x:Key="weaponCompactConverter"/>
        <local:ArmorCompactConverter x:Key="armorCompactConverter"/>
        <local:ShieldCompactConverter x:Key="shieldCompactConverter"/>
        <local:SWeaponCompactConverter x:Key="sWeaponCompactConverter"/>
        <local:MagCompactConverter x:Key="magCompactConverter"/>
        <local:RegularItemCompactConverter x:Key="regularItemCompactConverter"/>
        <local:UnitCompactConverter x:Key="unitCompactConverter"/>
        <local:TechDiskCompactConverter x:Key="techDiskCompactConverter"/>
        <local:CompactInventoryDataTemplateSelector x:Key="itemCompactTemplateSelector">
            <local:CompactInventoryDataTemplateSelector.DefaultTemplate>
                <DataTemplate>
                    <Label Content="{Binding ItemName}"/>
                </DataTemplate>
            </local:CompactInventoryDataTemplateSelector.DefaultTemplate>
            <local:CompactInventoryDataTemplateSelector.WeaponTemplate>
                <DataTemplate>
                    <Label Margin="5,0,0,0" Padding="0,0,0,0">
                        <Label.Content>
                            <MultiBinding Converter="{StaticResource weaponCompactConverter}">
                                <Binding Path="ItemName"/>
                                <Binding Path="IsUntekked"/>
                                <Binding Path="IsBasic"/>
                                <Binding Path="Special"/>
                                <Binding Path="Grind"/>
                                <Binding Path="NativeBonus"/>
                                <Binding Path="ABeastBonus"/>
                                <Binding Path="MachineBonus"/>
                                <Binding Path="DarkBonus"/>
                                <Binding Path="HitBonus"/>
                                <Binding Path="Kills"/>
                            </MultiBinding>
                        </Label.Content>
                    </Label>
                </DataTemplate>
            </local:CompactInventoryDataTemplateSelector.WeaponTemplate>
            <local:CompactInventoryDataTemplateSelector.SWeaponTemplate>
                <DataTemplate>
                    <Label Margin="5,0,0,0" Padding="0,0,0,0">
                        <Label.Content>
                            <MultiBinding Converter="{StaticResource sWeaponCompactConverter}">
                                <Binding Path="ItemName"/>
                                <Binding Path="CustomName"/>
                                <Binding Path="Grind"/>
                            </MultiBinding>
                        </Label.Content>
                    </Label>
                </DataTemplate>
            </local:CompactInventoryDataTemplateSelector.SWeaponTemplate>
            <local:CompactInventoryDataTemplateSelector.ArmorTemplate>
                <DataTemplate>
                    <Label Margin="5,0,0,0" Padding="0,0,0,0">
                        <Label.Content>
                            <MultiBinding Converter="{StaticResource armorCompactConverter}">
                                <Binding Path="ItemName"/>
                                <Binding Path="Defense"/>
                                <Binding Path="DefenseBonus"/>
                                <Binding Path="Evasion"/>
                                <Binding Path="EvasionBonus"/>
                                <Binding Path="Slots"/>
                            </MultiBinding>
                        </Label.Content>
                    </Label>
                </DataTemplate>
            </local:CompactInventoryDataTemplateSelector.ArmorTemplate>
            <local:CompactInventoryDataTemplateSelector.ShieldTemplate>
                <DataTemplate>
                    <Label Margin="5,0,0,0" Padding="0,0,0,0">
                        <Label.Content>
                            <MultiBinding Converter="{StaticResource shieldCompactConverter}">
                                <Binding Path="ItemName"/>
                                <Binding Path="Defense"/>
                                <Binding Path="DefenseBonus"/>
                                <Binding Path="Evasion"/>
                                <Binding Path="EvasionBonus"/>
                            </MultiBinding>
                        </Label.Content>
                    </Label>
                </DataTemplate>
            </local:CompactInventoryDataTemplateSelector.ShieldTemplate>
            <local:CompactInventoryDataTemplateSelector.MagTemplate>
                <DataTemplate>
                    <Label Margin="5,0,0,0" Padding="0,0,0,0">
                        <Label.Content>
                            <MultiBinding Converter="{StaticResource magCompactConverter}">
                                <Binding Path="ItemName"/>
                                <Binding Path="DefLevel"/>
                                <Binding Path="PowLevel"/>
                                <Binding Path="DexLevel"/>
                                <Binding Path="MstLevel"/>
                                <Binding Path="Level"/>
                            </MultiBinding>
                        </Label.Content>
                    </Label>
                </DataTemplate>
            </local:CompactInventoryDataTemplateSelector.MagTemplate>
            <local:CompactInventoryDataTemplateSelector.RegularTemplate>
                <DataTemplate>
                    <Label Margin="5,0,0,0" Padding="0,0,0,0">
                        <Label.Content>
                            <MultiBinding Converter="{StaticResource regularItemCompactConverter}">
                                <Binding Path="ItemName"/>
                                <Binding Path="Count"/>
                            </MultiBinding>
                        </Label.Content>
                    </Label>
                </DataTemplate>
            </local:CompactInventoryDataTemplateSelector.RegularTemplate>
            <local:CompactInventoryDataTemplateSelector.UnitTemplate>
                <DataTemplate>
                    <Label Margin="5,0,0,0" Padding="0,0,0,0">
                        <Label.Content>
                            <MultiBinding Converter="{StaticResource unitCompactConverter}">
                                <Binding Path="ItemName"/>
                                <Binding Path="Kills"/>
                            </MultiBinding>
                        </Label.Content>
                    </Label>
                </DataTemplate>
            </local:CompactInventoryDataTemplateSelector.UnitTemplate>
            <local:CompactInventoryDataTemplateSelector.TechDiskTemplate>
                <DataTemplate>
                    <Label Margin="5,0,0,0" Padding="0,0,0,0">
                        <Label.Content>
                            <MultiBinding Converter="{StaticResource techDiskCompactConverter}">
                                <Binding Path="ItemName"/>
                                <Binding Path="Level"/>
                            </MultiBinding>
                        </Label.Content>
                    </Label>
                </DataTemplate>
            </local:CompactInventoryDataTemplateSelector.TechDiskTemplate>
        </local:CompactInventoryDataTemplateSelector>
        <local:InventoryDataTemplateSelector x:Key="itemContentTemplateSelector">
            <local:InventoryDataTemplateSelector.WeaponTemplate>
                <DataTemplate>
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Native:" />
                            <Label Content="{Binding NativeBonus}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="A. Beast:" />
                            <Label Content="{Binding ABeastBonus}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Machine:" />
                            <Label Content="{Binding MachineBonus}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Dark:" />
                            <Label Content="{Binding DarkBonus}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Hit:" />
                            <Label Content="{Binding HitBonus}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Grind:" />
                            <Label Content="{Binding Grind}" />
                            <Label Content="/" />
                            <Label Content="{Binding MaxGrind}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Special:" />
                            <Label Content="{Binding Special}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Untekked:" />
                            <Label Content="{Binding IsUntekked}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Kills:" />
                            <Label Content="{Binding Kills}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Atp boost range:" />
                            <Label Content="{Binding MinAtpBoost}" />
                            <Label Content="-" />
                            <Label Content="{Binding MaxAtpBoost}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Atp required:" />
                            <Label Content="{Binding AtpRequired}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Mst required:" />
                            <Label Content="{Binding MstRequired}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Ata required:" />
                            <Label Content="{Binding AtaRequired}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Atp boost:" />
                            <Label Content="Todo" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Def boost:" />
                            <Label Content="Todo" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Mst boost:" />
                            <Label Content="{Binding MstBoost}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Ata boost:" />
                            <Label Content="{Binding AtaBoost}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Evp boost:" />
                            <Label Content="Todo" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Lck boost:" />
                            <Label Content="Todo" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Equippable By:" />
                            <Label Content="{Binding EquippableBy, Converter={StaticResource equipabbleByConverter}}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Description:" />
                            <TextBlock Style="{StaticResource WrappedTextBlock}" Text="{Binding Description}"/>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </local:InventoryDataTemplateSelector.WeaponTemplate>
            <local:InventoryDataTemplateSelector.SWeaponTemplate>
                <DataTemplate>
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Grind:" />
                            <Label Content="{Binding Grind}" />
                            <Label Content="/" />
                            <Label Content="{Binding MaxGrind}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Special:" />
                            <Label Content="{Binding Special}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Atp boost range:" />
                            <Label Content="{Binding MinAtpBoost}" />
                            <Label Content="-" />
                            <Label Content="{Binding MaxAtpBoost}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Atp required:" />
                            <Label Content="{Binding AtpRequired}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Mst required:" />
                            <Label Content="{Binding MstRequired}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Ata required:" />
                            <Label Content="{Binding AtaRequired}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Atp boost:" />
                            <Label Content="Todo" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Def boost:" />
                            <Label Content="Todo" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Mst boost:" />
                            <Label Content="{Binding MstBoost}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Ata boost:" />
                            <Label Content="{Binding AtaBoost}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Evp boost:" />
                            <Label Content="Todo" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Lck boost:" />
                            <Label Content="Todo" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Equippable By:" />
                            <Label Content="{Binding EquippableBy, Converter={StaticResource equipabbleByConverter}}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Description:" />
                            <TextBlock Style="{StaticResource WrappedTextBlock}" Text="{Binding Description}"/>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </local:InventoryDataTemplateSelector.SWeaponTemplate>
            <local:InventoryDataTemplateSelector.ArmorTemplate>
                <DataTemplate>
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Base Def:" />
                            <Label Content="{Binding Defense}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Base Evasion:" />
                            <Label Content="{Binding Evasion}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Def Bonus:" />
                            <Label Content="{Binding DefenseBonus}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Evp Bonus:" />
                            <Label Content="{Binding EvasionBonus}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Level Requirement:" />
                            <Label Content="{Binding LevelRequirement}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="EFR:" />
                            <Label Content="{Binding Efr}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="EIC:" />
                            <Label Content="{Binding Eic}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="ETH:" />
                            <Label Content="{Binding Eth}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="EDK:" />
                            <Label Content="{Binding Edk}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="ELT:" />
                            <Label Content="{Binding Elt}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Slots:" />
                            <Label Content="{Binding Slots}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Equippable By:" />
                            <Label Content="{Binding EquippableBy, Converter={StaticResource equipabbleByConverter}}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Description:" />
                            <TextBlock Style="{StaticResource WrappedTextBlock}" Text="{Binding Description}"/>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </local:InventoryDataTemplateSelector.ArmorTemplate>
            <local:InventoryDataTemplateSelector.ShieldTemplate>
                <DataTemplate>
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Base Def:" />
                            <Label Content="{Binding Defense}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Base Evasion:" />
                            <Label Content="{Binding Evasion}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Def Bonus:" />
                            <Label Content="{Binding DefenseBonus}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Evp Bonus:" />
                            <Label Content="{Binding EvasionBonus}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Level Requirement:" />
                            <Label Content="{Binding LevelRequirement}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="EFR:" />
                            <Label Content="{Binding Efr}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="EIC:" />
                            <Label Content="{Binding Eic}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="ETH:" />
                            <Label Content="{Binding Eth}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="EDK:" />
                            <Label Content="{Binding Edk}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="ELT:" />
                            <Label Content="{Binding Elt}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Equippable By:" />
                            <Label Content="{Binding EquippableBy, Converter={StaticResource equipabbleByConverter}}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Description:" />
                            <TextBlock Style="{StaticResource WrappedTextBlock}" Text="{Binding Description}"/>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </local:InventoryDataTemplateSelector.ShieldTemplate>
            <local:InventoryDataTemplateSelector.UnitTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Description:" />
                        <TextBlock Style="{StaticResource WrappedTextBlock}" Text="{Binding Description}"/>
                    </StackPanel>
                </DataTemplate>
            </local:InventoryDataTemplateSelector.UnitTemplate>
            <local:InventoryDataTemplateSelector.MagTemplate>
                <DataTemplate>
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Sync:" />
                            <Label Content="{Binding Sync}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Iq:" />
                            <Label Content="{Binding Iq}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Def:" />
                            <Label Content="{Binding DefLevel}"/>
                            <Label Content=" | "/>
                            <Label Content="{Binding NextDef}"/>
                            <Label Content="/ 100"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Pow:" />
                            <Label Content="{Binding PowLevel}"/>
                            <Label Content=" | "/>
                            <Label Content="{Binding NextPow}"/>
                            <Label Content="/ 100"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Dex:" />
                            <Label Content="{Binding DexLevel}"/>
                            <Label Content=" | "/>
                            <Label Content="{Binding NextDex}"/>
                            <Label Content="/ 100"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Mst:" />
                            <Label Content="{Binding MstLevel}"/>
                            <Label Content=" | "/>
                            <Label Content="{Binding NextMst}"/>
                            <Label Content="/ 100"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Photon Blasts: " />
                            <Label Content="{Binding LeftPhotonBlast}"/>
                            <Label Content=" | "/>
                            <Label Content="{Binding CenterPhotonBlast}"/>
                            <Label Content=" | "/>
                            <Label Content="{Binding RightPhotonBlast}"/>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </local:InventoryDataTemplateSelector.MagTemplate>
            <local:InventoryDataTemplateSelector.RegularTemplate>
                <DataTemplate>
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Count:" />
                            <Label Content="{Binding Count}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Description:" />
                            <TextBlock Style="{StaticResource WrappedTextBlock}" Text="{Binding Description}"/>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </local:InventoryDataTemplateSelector.RegularTemplate>
            <local:InventoryDataTemplateSelector.DefaultTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Description:" />
                        <TextBlock Style="{StaticResource WrappedTextBlock}" Text="{Binding Description}"/>
                    </StackPanel>
                </DataTemplate>
            </local:InventoryDataTemplateSelector.DefaultTemplate>
        </local:InventoryDataTemplateSelector>
        <DataTemplate x:Key="itemHeaderTemplate">
            <Grid HorizontalAlignment="Stretch" Background="{Binding Converter={StaticResource itemColorConverter}}">
                <Grid.ToolTip>
                    <!-- Since the tooltip is a ContentControl, its Content is its DataContext, thus the content is set as shown -->
                    <ToolTip ContentTemplateSelector="{StaticResource itemContentTemplateSelector}" Content="{Binding}"/>
                </Grid.ToolTip>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="15"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Label Grid.Column="0" FontWeight="Bold" Content="{Binding IsEquipped, Converter={StaticResource booleanToEquipConverter}}"/>
                <StackPanel Grid.Column="1" HorizontalAlignment="Stretch">
                    <ContentPresenter ContentTemplateSelector="{StaticResource itemCompactTemplateSelector}" />
                </StackPanel>
            </Grid>
        </DataTemplate>
    </Application.Resources>
</Application>
